<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="../../../object/coreObject/fix/FixArticleTypeObj.js"></script>
<title></title>
</head>
<body>
<script LANGUAGE="javascript">
var fixArticleTypeObj = new FixArticleTypeObj();
var url = "../../article.php?type=";
function redirectPageComplete(type)
{	
	alert("แก้ไขบทความสำเร็จ");
	location = url+type;
}

function redirectPageIncomplete(type)
{
	alert("เกิดข้อผิดพลาดในการแก้ไขข้อมูล");
	location = url+type;
}

function redirectPageIsnull(type)
{
	alert("ข้อมูลบางส่วนยังเป็น่ค่าว่าง กรุณาลงใหม่อีกครั้ง");
	location = url+type;
	
}



<?php
include '../../../dbconfig.php';
$id = addslashes($_POST['article_id']);
$author = addslashes($_POST['article_author']);
$title = addslashes($_POST['article_title']);
$type = addslashes($_POST['article_type']);
$description = htmlentities($_POST['article_description'], ENT_QUOTES, "UTF-8");
$status = $_POST['article_status'];
$modified_mid = "1";
$modified_datetime = date("Y-m-d H:i:s"); //เก็บวันเดือนปีและเวลาด้วย function date
if(isset($id,$author,$title,$description,$status,$modified_mid,$modified_datetime)){
	$sql = "UPDATE article 
			SET reference_st = '$author',
			title = '$title',
			description = '$description',
			fix_status = '$status',
			modified_master_id = '$modified_mid',
			modified_date_time = '$modified_datetime' 
			WHERE article_id= $id";
	if(mysql_query($sql)){
	 	echo "redirectPageComplete($type);";
	}else{	
		echo "redirectPageIncomplete($type);";
	}	
	mysql_close();	
}
else
{
	echo "redirectPageIsnull($type);";
}
?>
</script>
</body>
</html>
